﻿//********************************************************************
// 
//  file:  frmFileTotalLogsSearch.cs
// 
//  (C) Copyright 2010, Diomede Corporation
//  All rights reserved
// 
//  Use, modification, and distribution is subject to   
//  the New BSD License (See accompanying file license.txt).
// 
//********************************************************************

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Diomede.SDK;

namespace Diomede.Explorer
{
    public partial class frmFileTotalLogsSearch : Form
    {
        public frmFileTotalLogsSearch()
        {
            InitializeComponent();
        }

        public frmFileTotalLogsSearch(ISession session)
        {
            InitializeComponent();
            Session = session;
        }

        public ISession  Session  { get; set; }

        private void frmFileTotalLogsSearch_Load(object sender, EventArgs e)
        {
            dtFrom.Value = DateTime.Today;
            dtTo.Value = DateTime.Today;
        }

        private void btnShow_Click(object sender, EventArgs e)
        {
            DateTime dateFrom = dtFrom.Value.Date;
            DateTime dateTo = dtTo.Value.Date.AddDays(1).AddSeconds(-1);
            ILogsManagement log = Session as ILogsManagement;
            ISearchMergeLogsExecResult result = log.SearchMergedActivityLogs(dateFrom, dateTo, 0, 100);
            if (result.Status == Diomede.SDK.Enums.ExecutionResults.Success)
            {
                frmSummaryInfo frm = new frmSummaryInfo(result.FileTotalInfo, "Activity Info Summary");
                frm.StartPosition = FormStartPosition.CenterParent;
                frm.ShowDialog(this);
            }

        }
    }
}
